from loguru import logger
from gp.portal import create_app
from flask import redirect

class Config:
    MODULES = dict(
        CHATGPT = dict(
            package = "gp_flask_ext.flask_chatgpt",
        ),
        OTP = dict(
            package = "gp_flask_ext.flask_otp",
        )
    )

def main():
    app = create_app(__name__, default_config=Config)
    @app.route('/')
    def index():
        return redirect('/chatgpt/')

    logger.info("app started")
    app.run(debug=False, port=5100, host='0.0.0.0')
    
if __name__ == '__main__':
    main()